QT += core gui
QT += sql
QT += network
QT += winextras
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
RC_ICONS = "icon/app.ico"
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    Alg/Base.cpp \
    Alg/Classify.cpp \
    Alg/StreamManager.cpp \
    Alg/WoodDetect.cpp \
    Alg/initializationworker.cpp \
    Alg/wooddetectprocessor.cpp \
    Dlg/batchdlg.cpp \
    Dlg/defectdlg.cpp \
    Dlg/gradeconfigdialog.cpp \
    Dlg/plandlg.cpp \
    Dlg/softinfodlg.cpp \
    From/algtestform.cpp \
    From/camerasetform.cpp \
    From/dataform.cpp \
    From/defectform.cpp \
    From/mainform.cpp \
    From/motorform.cpp \
    From/plansform.cpp \
    From/progressbarwidget.cpp \
    From/saveform.cpp \
    From/setplansform.cpp \
    From/systemform.cpp \
    From/versionsform.cpp \
    From/woodtypeform.cpp \
    From/workhisform.cpp \
    SqliteUtil/sqliteutil.cpp \
    Thread/camerathread.cpp \
    Thread/cameraworker.cpp \
    Thread/saveimgthread.cpp \
    Thread/saveimgworker.cpp \
    cameracontroller.cpp \
    main.cpp \
    mainwindow.cpp \
    motor/maincontroller.cpp \
    motor/motorworker.cpp \
    motor/sensor1worker.cpp \
    motor/sensor2worker.cpp \
    motor/sensor3worker.cpp \
    motor/sensorworker.cpp \
    zoomablelabel.cpp

HEADERS += \
    Alg/Api_WoodDetect.h \
    Alg/Base.h \
    Alg/Classify.h \
    Alg/initializationworker.h \
    Alg/wooddetectprocessor.h \
    Common/common.h \
    Dlg/batchdlg.h \
    Dlg/defectdlg.h \
    Dlg/gradeconfigdialog.h \
    Dlg/plandlg.h \
    Dlg/softinfodlg.h \
    From/algtestform.h \
    From/camerasetform.h \
    From/dataform.h \
    From/defectform.h \
    From/mainform.h \
    From/motorform.h \
    From/plansform.h \
    From/progressbarwidget.h \
    From/saveform.h \
    From/setplansform.h \
    From/systemform.h \
    From/versionsform.h \
    From/woodtypeform.h \
    From/workhisform.h \
    SqliteUtil/sqliteutil.h \
    Thread/camerathread.h \
    Thread/cameraworker.h \
    Thread/saveimgthread.h \
    Thread/saveimgworker.h \
    cameracontroller.h \
    mainwindow.h \
    motor/maincontroller.h \
    motor/motorworker.h \
    motor/sensor1worker.h \
    motor/sensor2worker.h \
    motor/sensor3worker.h \
    motor/sensorworker.h \
    zoomablelabel.h

FORMS += \
    Dlg/batchdlg.ui \
    Dlg/defectdlg.ui \
    Dlg/gradeconfigdialog.ui \
    Dlg/plandlg.ui \
    Dlg/softinfodlg.ui \
    From/algtestform.ui \
    From/camerasetform.ui \
    From/dataform.ui \
    From/defectform.ui \
    From/mainform.ui \
    From/motorform.ui \
    From/plansform.ui \
    From/progressbarwidget.ui \
    From/saveform.ui \
    From/setplansform.ui \
    From/systemform.ui \
    From/versionsform.ui \
    From/woodtypeform.ui \
    From/workhisform.ui \
    mainwindow.ui

TRANSLATIONS += \
    Mz_Wood_zh_CN.ts

CONFIG += lrelease
CONFIG += embed_translations

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target



include($$PWD/AppKey/appkey.pri)
include($$PWD/Action/action.pri)
include($$PWD/InitForm/initForm.pri)
include($$PWD/SaveLog/savelog.pri)
include($$PWD/Message/message.pri)
include($$PWD/ToggleSwitch/toggleswitch.pri)

RESOURCES += \
    res.qrc



#--------------------------------------------Da Hua-------------------------------------------
INCLUDEPATH += $$PWD/Include
Debug {
        contains(QMAKE_COMPILER_DEFINES, _WIN64) {
                LIBS += -L$$PWD/Depends/x64/vs2013shared				-lMVSDKmd
                DESTDIR = $$PWD/Bin/x64
        }
        else {
                LIBS += -L$$PWD/Depends/win32/vs2013shared				-lMVSDKmd
                DESTDIR = $$PWD/Bin/win32
        }
}
else {
        contains(QMAKE_COMPILER_DEFINES, _WIN64) {
                LIBS += -L$$PWD/Depends/x64/vs2013shared				-lMVSDKmd
                DESTDIR = $$PWD/Bin/x64
        }
        else {
                LIBS += -L$$PWD/Depends/win32/vs2013shared				-lMVSDKmd
                DESTDIR = $$PWD/Bin/win32
    }
}

#--------------------------------------------Alg-------------------------------------------
win32 {
    OPENCV_PATH = $$PWD/lib3rd
    ONNXRUN_PATH = $$PWD/packages/Microsoft.ML.OnnxRuntime.Gpu.1.16.1

    INCLUDEPATH += $$ONNXRUN_PATH/build/native/include

    INCLUDEPATH += $$OPENCV_PATH/crow/include
    INCLUDEPATH += $$OPENCV_PATH/boost
    INCLUDEPATH += $$OPENCV_PATH/opencv4.6/include
    INCLUDEPATH += $$OPENCV_PATH/detector/include
    INCLUDEPATH += $$OPENCV_PATH/dinov2/include
    INCLUDEPATH += $$OPENCV_PATH/tbb/include

    CONFIG(debug, debug|release) {
        LIBS += -L$$OPENCV_PATH/opencv4.6/lib \
                -lopencv_world460d
    } else {
        LIBS += -L$$OPENCV_PATH/opencv4.6/lib \
                -lopencv_world460
        LIBS += -L$$OPENCV_PATH/detector/release \
                -lDetector
        LIBS += -L$$OPENCV_PATH/dinov2/release \
                -lDinov2
        LIBS += -L$$OPENCV_PATH/tbb/lib \
                -ltbb12
        LIBS += -L$$ONNXRUN_PATH/runtimes/win-x64/native \
                -lonnxruntime
    }
}


#--------------------------------------------plc-------------------------------------------
win32 {
    PLC_PATH = $$PWD/plc


    INCLUDEPATH += $$PLC_PATH/include

    CONFIG(debug, debug|release) {

    } else {
        LIBS += -L$$PLC_PATH/DLL/DLL_X64 \
                -lMCDLL_NET
    }
}
